<?php
namespace App\Module\User\Controller;

use App\Common\Controller\AbstractController;
use App\Module\User\Service\NewsService;
use Hyperf\Di\Annotation\Inject;

class NewsController extends AbstractController{

    /**
     * @Inject()
     * @var NewsService $newsService
     */
    private $newsService;

    public function search(){
        $pagesize = $this->request->input("pagesize");
        return $this->response->json($this->newsService->search($pagesize));
    }

    public function getById(int $id){
        return $this->response->json($this->newsService->getById($id));
    }
}